package com.qtyx.nms.ui.activity

import android.graphics.Color
import androidx.recyclerview.widget.GridLayoutManager
import com.qtyx.nms.R
import com.qtyx.nms.mvp.model.bean.NurseBean
import com.qtyx.nms.ui.adapter.BedAdapter
import com.qtyx.nms.ui.base.BaseActivity
import com.qtyx.nms.util.IntentKey
import kotlinx.android.synthetic.main.ac_bed_list.*

/**
 * 床位列表
 * 只显示床位信息
 */
class BedListActivity: BaseActivity() {
    override fun getLayoutId()= R.layout.ac_bed_list

    override fun initData() {
        val data=intent.getSerializableExtra(IntentKey.nurseBedInfo) as NurseBean.Data
        val selectPosition=intent.getIntExtra(IntentKey.nurseBedSelectPosition,-1)
        tvBedListName.text=data.nursprogName
        if(data.titleColor.isNotEmpty()){
            tvBedListName.setTextColor(Color.parseColor(data.titleColor))
        }
        val list=data.sqlData
        if(list.isNotEmpty()){
            rvBedList.layoutManager=GridLayoutManager(mContext,11)
            val adapter= BedAdapter(mContext,list)
            adapter.contentColor=data.contentColor
            adapter.selectPosition=selectPosition
            rvBedList.adapter=adapter
        }

    }
}